package udp.server;


import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

@SuppressWarnings({"all"})
// 字典服务器
public class UdpDicServer extends UdpEchoServer {
    public Map<String, String> map = new HashMap<>();
    public UdpDicServer(int port) throws SocketException { // 构造方法
        super(port);
        map.put("synchronized", "同步的");
        map.put("volatile", "易变的");

    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request, "抱歉，当前尚未收录此词！");
    }

    public static void main(String[] args) throws IOException {
        UdpDicServer server = new UdpDicServer(8000);
        server.start();
    }
}
